@extends('layout.index')
@section('title','后台用户修改')

@section('content')
<div class="row">
    <div class="col-lg-8">
        <h1 class="page-header">用户修改</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>

<div class="row">
	
    <div class="col-lg-8 ">
    	<div class="panel panel-default">						<div class="panel-heading">	
    			<!-- 显示内存中的错误信息 -->
    			<!-- @if(session('error'))
    			<div class="alert alert-danger alert-dismissable">
                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                    {{session('error')}}
                </div>
                @endif -->

                @if (count($errors) > 0)
				    <div class="alert alert-danger">
				        <ul>
				            @foreach ($errors->all() as $error)
				                <li>{{ $error }}</li>
				            @endforeach
				        </ul>
				    </div>
				@endif
    		</div>		

    		<div class="row">
    		<div class="col-lg-2"></div>
    			  <div class="col-lg-8 ">
    			<br>
			<form role="form" action="{{url('/admin/user/update')}}" method="post" enctype="multipart/form-data">
				<input type="hidden" name="uid" value="{{$user->id}}">
      			<input type="hidden" name="oldpic" value="{{$user->pic}}">
			    <div class="form-group">
			        <label>用户名</label>
			        <input type="text" value="{{$user->username}}" name="username" value="{{old('username')}}" class="form-control">
			    </div>
			    
			     <div class="form-group">
			        <label>邮箱</label>
			        <input type="text" value="{{$user->email}}" name="email" value="{{old('email')}}" class="form-control">
			    </div>
			    <div class="form-group">
			        <label>手机号</label>
			        <input type="text" value="{{$user->phone}}" name="phone" value="{{old('phone')}}"  class="form-control">
			    </div>
				
				<div class="form-group">
                    <label>用户状态</label>
                    <label class="radio-inline">
                        <input type="radio" checked="" value="0" id="optionsRadiosInline1" name="status" 
						@if($user->status == 0)
						checked	
						@endif
                        >已激活
                    </label>
                    <label class="radio-inline">
                        <input type="radio" value="1" id="optionsRadiosInline2" name="status"
						@if($user->status == 1)
						checked		
						@endif
                        >未激活
                    </label>
                </div>

			    <div class="form-group">
			        <label>头像</label>&nbsp;&nbsp;&nbsp;
			        <img src="{{$user->pic}}" width="100px" alt="">
			        <input type="file" name="pic">
			    </div>
			    {{csrf_field()}}
			    <button class="btn btn-primary " type="submit">修改</button>
			    <button class="btn btn-warning " type="reset">重置</button>
			</form>
			</div>
			</div>
			<br>
	</div>
   </div>
</div>
@endsection